import request from '@/utils/request'

// 获取角色API
export const getRoleList = (params) => {
  return request({
    url: '/sys/role',
    params
  })
}

// 获取删除角色API，id是角色的id
export function deleteRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

// 角色新增
export function addRole(data) {
  return request({
    url: '/sys/role',
    data,
    method: 'post'
  })
}

// 获取角色详情
export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

// 编辑角色数据
export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    data,
    method: 'put'
  })
}
